package com.cebbank.group.demoweb;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.lang.Nullable;
import org.springframework.stereotype.Component;

/**
 * Created by yl on 2019/9/19
 */
@Component
public class MyBeanPostProcessor1 implements BeanPostProcessor {
    @Nullable
    public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
        /*if(beanName.equalsIgnoreCase("ZInitBeanTestClass")) {
            System.out.println("MyBeanPostProcessor1 postProcessBeforeInitialization");

        }*/
        System.out.println("post1 before   "+beanName);
        return bean;
    }

    @Nullable
    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
        /*if(beanName.equalsIgnoreCase("ZInitBeanTestClass")){
            System.out.println("MyBeanPostProcessor1 postProcessAfterInitialization");
        }*/
        System.out.println("post1 after  "+beanName);
        return bean;
    }


}
